from tkinter import *
import whatToEat_v7_main


def whatToEatClicked():
    person_number = e1.get()
    per_capita = e2.get()
    meat = e3.get()
    # dish_count = e4.get()
    if person_number == "":
        person_number = "10"
    if per_capita == "":
        per_capita = "15"
    if meat == "":
        meat = "3"
    # if dish_count == "":
    #     dish_count = "2"
    if person_number.isdigit() and per_capita.isdigit() and meat.isdigit():
        a = whatToEat_v7_main.what_to_eat(person_number, per_capita, meat)
    else:
        a = "请输入正确的值"
    dish_menu.config(text=a)


top = Tk()

top.title("选菜机")
Label(top, text="人数").grid(row=0, sticky=W)
Label(top, text="人均").grid(row=1, sticky=W)
Label(top, text="肉菜").grid(row=2, sticky=W)
# Label(top, text="菜数").grid(row=3, sticky=W)

e1 = Entry(top)
e2 = Entry(top)
e3 = Entry(top)
# e4 = Entry(top)

e1.grid(row=0, column=1)
e2.grid(row=1, column=1)
e3.grid(row=2, column=1)
# e4.grid(row=3, column=1)

bt = Button(top, text="选菜", command=whatToEatClicked, width=7, heigh=3)
bt.grid(row=0, column=3, columnspan=3, rowspan=4)

b = whatToEat_v7_main.what_to_eat("", "", "")
dish_menu = Label(top, text=b, width=20, fg="blue")
dish_menu.grid(row=4, column=1, columnspan=3, rowspan=3)

top.mainloop()
